package com.efuture.servlet.serveletcontext;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @description: 演示域对象 共享数据
 * @author zhaoshanshan
 * @date 2021/10/3 3:00 下午
 * @version 1.0
 */
@WebServlet("/DomainObjectTestTwo")
public class DomainObjectTestTwo extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletContext context = this.getServletContext();
        String msg = (String)context.getAttribute("msg");
        System.out.println(msg);

    }
}
